package com.moonciki.multids.config;

import com.moonciki.multids.constant.MultiDsConstant;
import com.moonciki.multids.properties.MultiDataSourceProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Slf4j
@Configuration
@EnableConfigurationProperties(MultiDataSourceProperty.class)
@AutoConfigureBefore(value = DataSourceAutoConfiguration.class)
@Import(value = {MultiDataSourceConfig.class})
@ConditionalOnProperty(prefix = MultiDsConstant.PREFIX, name = "enabled", havingValue = "true", matchIfMissing = false)
public class FreeMultiDsAutoConfiguration implements InitializingBean {

    @Override
    public void afterPropertiesSet() {

        log.info("FreeMultiDsAutoConfiguration_afterPropertiesSet");

    }

}
